// Copyright Leonid Shlyapnikov 2010
// Distributed under the GNU Lesser General Public License http://www.gnu.org/licenses/lgpl.html
//    author: Leonid Shlyapnikov, created on: Feb 1, 2010

#include "./Base.h"

#include <boost/exception/all.hpp>
#include <exception>
#include <sstream>

#include "./log.h"

namespace fixparser {

void
Base::operator delete(void* p, size_t size) {
    std::stringstream error;
    error << "Hidden Base::operator delete(void*, size_t) called, p: " << reinterpret_cast<int64_t>(p) << ", size: " << size;
    BOOST_THROW_EXCEPTION(std::runtime_error(error.str()));
}

void*
Base::operator new(size_t size) {
    std::stringstream error;
    error << "Hidden Base::operator new(size_t) called, size: " << size;
    BOOST_THROW_EXCEPTION(std::runtime_error(error.str()));
}

void*
Base::operator new[](size_t size) {
    std::stringstream error;
    error << "Hidden Base::operator new[] called, size: " << size;
    BOOST_THROW_EXCEPTION(std::runtime_error(error.str()));
}

void
Base::operator delete[](void* p) {
    std::stringstream error;
    error << "Hidden Base::operator delete[] called, p: " << reinterpret_cast<int64_t>(p);
    BOOST_THROW_EXCEPTION(std::runtime_error(error.str()));
}

}
